package cn.brilliantfuture.commentry.entity;

// Generated 2011-11-3 13:34:34 by Hibernate Tools 3.3.0.GA

import static javax.persistence.GenerationType.IDENTITY;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.validator.Length;
import org.hibernate.validator.NotNull;

/**
 * Villiage generated by hbm2java
 */
@Entity
@Table(name = "villiage", catalog = "cabinet")
public class Villiage implements java.io.Serializable {

	private static final long serialVersionUID = 1L;
	private Integer villiageId;
	private String name;
	private String description;
	private String contact;
	private String phone;
	private double latitude;
	private double longitude;
	private Date insertTime;
	private Integer insertUser;
	private boolean deleted;
	private String enName;
	private Area area;
	private Set<Location> locations = new HashSet<Location>(0);

	public Villiage() {
	}

	public Villiage(String name, boolean deleted, String enName) {
		this.name = name;
		this.deleted = deleted;
		this.enName = enName;
	}

	public Villiage(String name, String description, String contact,
			String phone, Date insertTime, Integer insertUser, boolean deleted,
			String enName,
			Set<Location> locations) {
		this.name = name;
		this.description = description;
		this.contact = contact;
		this.phone = phone;
		this.insertTime = insertTime;
		this.insertUser = insertUser;
		this.deleted = deleted;
		this.enName = enName;
		this.locations = locations;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "villiage_id", unique = true, nullable = false)
	public Integer getVilliageId() {
		return this.villiageId;
	}

	public void setVilliageId(Integer villiageId) {
		this.villiageId = villiageId;
	}

	@Column(name = "name", nullable = false, length = 45)
	@NotNull
	@Length(max = 45)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "description", length = 200)
	@Length(max = 200)
	public String getDescription() {
		return this.description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	@Column(name = "contact", length = 45)
	@Length(max = 45)
	public String getContact() {
		return this.contact;
	}

	public void setContact(String contact) {
		this.contact = contact;
	}

	@Column(name = "phone", length = 45)
	@Length(max = 45)
	public String getPhone() {
		return this.phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "insert_time", length = 19)
	public Date getInsertTime() {
		return this.insertTime;
	}

	public void setInsertTime(Date insertTime) {
		this.insertTime = insertTime;
	}

	@Column(name = "insert_user")
	public Integer getInsertUser() {
		return this.insertUser;
	}

	public void setInsertUser(Integer insertUser) {
		this.insertUser = insertUser;
	}

	@Column(name = "deleted", nullable = false)
	public boolean isDeleted() {
		return this.deleted;
	}

	public void setDeleted(boolean deleted) {
		this.deleted = deleted;
	}

	@Column(name = "en_name", nullable = false, length = 100)
	@NotNull
	@Length(max = 100)
	public String getEnName() {
		return this.enName;
	}

	public void setEnName(String enName) {
		this.enName = enName;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "villiage")
	public Set<Location> getLocations() {
		return this.locations;
	}

	public void setLocations(Set<Location> locations) {
		this.locations = locations;
	}
	
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "area_id")
	public Area getArea() {
		return area;
	}

	public void setArea(Area area) {
		this.area = area;
	}

	@Column(name = "latitude")
	public double getLatitude() {
		return latitude;
	}

	public void setLatitude(double latitude) {
		this.latitude = latitude;
	}

	@Column(name = "longitude")
	public double getLongitude() {
		return longitude;
	}

	public void setLongitude(double longitude) {
		this.longitude = longitude;
	}

}
